package com.zx.service.impl;

import com.zx.mapper.SmbmsUserMapper;
import com.zx.pojo.SmbmsUser;
import com.zx.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务逻辑层实现类
 */
@Service  //在容器中創建bean
public class UsersServiceImpl implements UsersService {
    @Autowired  //給userMapper注入一個對象
    private SmbmsUserMapper userMapper;


//    public void setUserMapper(SmbmsUserMapper userMapper) {
//        this.userMapper = userMapper;
//    }

    @Override
    public List<SmbmsUser> findAllByUsers() {
        return userMapper.findAllByUsers();
    }

    @Override
    public boolean addUsers(SmbmsUser user) {
        return userMapper.addUsers(user);
    }

    @Override
    public boolean delUsers(Long uid) {
        return userMapper.delUsers(uid);
    }

    @Override
    public boolean updateUsers(SmbmsUser user) {
        return userMapper.updateUsers(user);
    }

    @Override
    public SmbmsUser findUsersById(Long uid) {
        return userMapper.findUsersById(uid);
    }

    @Override
    public SmbmsUser login(String uname, String upwd) {
        String name = uname.toLowerCase();
        return userMapper.login(name, upwd);
    }


}
